home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / c / nullmodem / src / defs.h < prev    next >
C/C++ Source or Header  |  1995-12-18  |  3KB  |  83 lines

  1. #include <exec/types.h>
  2. #include <exec/nodes.h>
  3. #include <exec/errors.h>
  4. #include <exec/memory.h>
  5. #include <exec/libraries.h>
  6. #include <exec/devices.h>
  7. #include <exec/resident.h>
  8. #include <exec/semaphores.h>
  9. #include <exec/execbase.h>
  10. #include <dos/dos.h>
  11. #include <dos/dostags.h>
  12. #include <devices/serial.h>
  13. #include <devices/timer.h>
  14. #include <clib/exec_protos.h>
  15. #include <clib/dos_protos.h>
  16.  
  17. #define arraysize(array)  (sizeof((array))/sizeof(*(array)))
  18.  
  19. #define SREG_ANSWER     000     /* auto-answer after # rings */
  20. #define SREG_DEBUG      001     /* Debug loglevel */
  21. #define SREG_TIMEOUT    002     /* # of seconds to ring */
  22. #define SREG_DELAY      003     /* negotiation time for ATA */
  23. #define SREG_SPEED      004     /* type of connect msg */
  24. #define SREG_BACKSPACE  005     /* backspace character */
  25. #define SREG_CMD_COUNT  006     /* # of chars in command buffer */
  26. #define SREG_PROTOCOL   007     /* type of protocol to report */
  27. #define SREG_RINGS      010     /* # of rings to do  before timeout */
  28. #define SREG_ANSWERING  011     /* how long to wait before we answer */
  29. #define SREG_LOCALECHO  012     /* whether the modem echos commands or not */
  30. #define SREG_NUMERIC    013     /* verbose/numerical result codes */
  31. #define SREG_STATE      077     /* internal state */
  32.  
  33. #define STATE_COMMAND       0
  34. #define STATE_CONNECTED     1
  35. #define STATE_ANSWERING     2
  36. #define STATE_DIALING       3
  37.  
  38. #define MODEM_STACK_SIZE    4096
  39. #define MODEM_TASK_PRI      0
  40. #define MODEM_UNITS         5
  41.  
  42. #define UNIT_BUF_SIZE       4096
  43.  
  44. struct NullUnit {
  45.     struct MinList          u_Readlist;         /* read requests */
  46.     struct MinList          u_Writelist;        /* write requests */
  47.  
  48.     UWORD                   u_OpenCnt;
  49.     UWORD                   u_Unitnum;          /* my number */
  50.     UWORD                   u_Flags;            /* SHARED */
  51.  
  52.     UBYTE                   u_SReg[64];
  53.  
  54.     char                    u_Command[256];     /* command line */
  55.     char                    u_Buffer[UNIT_BUF_SIZE];    /* io buffer */
  56.     UWORD                   u_Bufcount;
  57.     char                   *u_Readptr;
  58.     char                   *u_Writeptr;
  59.  
  60.     struct NullModem       *u_Modem;
  61. };
  62.  
  63. struct NullModem {
  64.     struct Task            *nm_Taskptr;     /* actually a process */
  65.  
  66.     struct timerequest      nm_Timerequest;
  67.     struct MsgPort          nm_TimePort;
  68.  
  69.     UWORD                   nm_OpenCnt;
  70.     UWORD                   nm_Modemnum;
  71.  
  72.     struct SignalSemaphore  nm_Semaphore;        /* access to modem */
  73.     struct NullUnit        *nm_Unit[2];
  74. };
  75.  
  76. struct NullBase {
  77.     struct Library      b_Lib;
  78.     APTR                b_Segment;
  79.     struct NullModem   *b_Modem[MODEM_UNITS];
  80. };
  81.  
  82. extern struct NullBase *DevBase;
  83.